--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[

胡桃能够奔跑，但饱度大于80%时无法进食（可以通过进食让饱食度超过80%）。
饱度大于80%时进食失败有台词：
是女也，食也饱力也足，正是才美外见时~/果擘洞庭橘，脍切天池鳞。可惜吃太饱，徒然生悲情！

使用了hook过的官方的台词提取器：GetString(inst, stringtype, modifier, nil_missing)

其中，拒绝食物是  GetString(inst, "ANNOUNCE_EAT", "YUCKY")

]]--
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---
    local function hook_eater_com(inst)
        if inst.components.eater == nil then
            print("HuTao Errer : eater_com_hook.lua : eater component not found")
            return
        end

        local old_PrefersToEat = inst.components.eater.PrefersToEat
        inst.components.eater.PrefersToEat = function(self,item,...)
            if self.inst.components.hunger:GetPercent() > 0.8 and not TUNING.HUTAO_DEBUGGING_MODE then
                -- self.inst.components.hutao_com_dialogue:Say("eater_com_refused",0)
                return false
            end
            return old_PrefersToEat(self,item,...)
        end

        inst.components.hutao_com_dialogue:SetStringReplacerFn("ANNOUNCE_EAT","YUCKY",function()
            return inst.components.hutao_com_dialogue:GetInspect("eater_com_refused")
        end)

    end
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

return function(inst)
    if not TheWorld.ismastersim then
        return
    end
    inst:ListenForEvent("hutao_master_postinit", hook_eater_com)
end